local story_savegz_skill = fk.CreateSkill {
  name = "#story_savegz_skill",
  tags = { Skill.Compulsory, },
}


story_savegz_skill:addEffect(fk.EnterDying, {
  name = "#story_savegz_skill",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(story_savegz_skill.name) and player.room.logic.Wdtx
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local Wdtx = room.logic.Wdtx
    for i, pr in ipairs(room.players) do
      if pr:hasSkill(story_savegz_skill.name) then
        room:handleAddLoseSkills(pr, "-"..story_savegz_skill.name, nil, false)
      end
    end
    room:setTag("savegz",player.id)
    local curinfo = Wdtx.storyobj:getCurInfo()
    Wdtx.storyobj:setCurInfo({startpos = curinfo.startpos,selchcinx = 1})
    Wdtx:continueStory(curinfo.startpos, 1)
  end
})


return story_savegz_skill